package com.zenith.common.annotation.request;

import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.lang.annotation.*;

/**
 * 组合注解：GetMapping + RequiresRole + RequiresPermission
 * 用于简化权限控制的GET请求映射
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@RequestMapping(method = RequestMethod.GET)
public @interface SecureGetMapping {

    /**
     * 映射的URL路径
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] value() default {};

    /**
     * 映射的URL路径（别名）
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] path() default {};

    /**
     * 需要的角色
     */
    String[] roles() default {};

    /**
     * 需要的权限
     */
    String permission() default "";

    /**
     * RequestMapping的其他属性
     */
    @AliasFor(annotation = RequestMapping.class)
    String name() default "";

    @AliasFor(annotation = RequestMapping.class)
    String[] params() default {};

    @AliasFor(annotation = RequestMapping.class)
    String[] headers() default {};

    @AliasFor(annotation = RequestMapping.class)
    String[] consumes() default {};

    @AliasFor(annotation = RequestMapping.class)
    String[] produces() default {};
}
